---@class Battle.BuffEffect10022001:Battle.BuffEffectBase
---[[
--- X秒内未主动造成伤害会进入隐身状态，隐身状态下发起首次攻击提高30%暴击率。
---]]
local BuffEffect10022001 = Battle.CreateClass("BuffEffect10022001",Battle.BuffEffectBase)
Battle.BuffEffect10022001 = BuffEffect10022001
function BuffEffect10022001:OnCreate(buff)
    ---@type Battle.Skill
    self.buff = buff;
    ---@type Battle.Entity
    self.actor = Battle.ActorManager.GetActor(self.buff.targetId)
    self.param = decodeJsonStrToTable(buff.cfg.f_EffectParameter);
    ---@type table<number,number>
    self.maxTime = self.param[1][1]/1000;
    self.curTime = 0;--倒计时时间
end

function BuffEffect10022001:Update(dt)
    local buff = Battle.BufferMgr.GetBuff(self.actor.id, self.param[1][2]);
    if not buff then
        self.curTime = self.curTime + dt;
        if self.maxTime <= self.curTime then
            self:AddBuff();
            self.curTime = 0;
        end
    end

end

---buff生效时
function BuffEffect10022001:OnBuffStart(...)
    self.curTime = 0;--造成伤害了 重置时间
end
--
function BuffEffect10022001:AddBuff()
    local actor = Battle.ActorManager.GetActor(self.buff.targetId)
    for i, v in pairs(self.param) do
        actor:AddBuff(v[2], 1, nil, actor,nil,self.buff.buffId)
        --local buff = Battle.BufferMgr.GetBuff(self.actor.id, self.param[1][2])
    end
end
return BuffEffect10022001